home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 235 / Issue 235 - September 2007 - DPCS0907DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / FSI / Update / lib / nof / update / html / UpdatesMainWindow.js < prev   
Encoding:
Text File  |  2007-04-11  |  5.4 KB  |  161 lines

  1.   /****i* SOURCE_FILE/INFO
  2.   *
  3.   * NAME
  4.   *  UpdatesMainWindow.js
  5.   *
  6.   * USAGE
  7.   *  Part of Netobjects JavaScript Library.
  8.   *
  9.   * COPYRIGHT
  10.   *  Copyright ⌐ 2002-2004 Website Pros, Inc.
  11.   *  All Rights Reserved.
  12.   *
  13.   *  This is an unpublished work protected by Website Pros, Inc.
  14.   *  as a trade secret, and is not to be used or disclosed except as
  15.   *  expressly provided in a written license agreement executed by
  16.   *  you and Website Pros, Inc.
  17.   *
  18.   *      <copyright@websitepros.com>
  19.   *
  20.   * NOTES
  21.   *  JavaScript code.
  22.   *****/
  23.  
  24. if (!IS_isModuleInitialized("IS.NOF.UPDATE.HTML.UpdatesMainWindow"))
  25. {   
  26.     /****h* NOF_JavaScript_Library/NOF.UPDATE.HTML.UpdatesMainWindow
  27.     *
  28.     * NAME
  29.     *  NOF.UPDATE.HTML.UpdatesMainWindow
  30.     *
  31.     * DESCRIPTION
  32.     *    
  33.     * The <code>UpdatesMainWindow</code> class, first tab panel editor.
  34.     * External dependencies: NOF.App, NOF.HTML.EditorWindow, NOF.DIALOGS.ProgressDlg, NOF.DIALOGS.StatusDlg,
  35.     * NOF.UI.TabbedMenu, NOF.UI.TabMenuItem
  36.     ****/    
  37.  
  38.     /** UpdatesMainWindow
  39.     * @param _editedElem, the element being edited
  40.     * @param _document, the browser document this editor will reside
  41.     * @param _name
  42.     */
  43.     function NOF_UpdatesMainWindow( _editedElement, _document, _name ) {    
  44.         
  45.         this.__proto__ = NOF_UpdatesMainWindow.prototype;  
  46.         
  47.         if ( arguments.length == 0 )
  48.             this.SUPER();
  49.         else {
  50.             this.SUPER( _editedElement, _document, _name );
  51.             this.defaultName = "UPDATES_EDITOR";
  52.             
  53.             this.currentUpdateEditor    = new NOF.UPDATE.HTML.CurrentUpdateEditor ( _editedElement, _document );
  54.             this.previousUpdatesEditor  = new NOF.UPDATE.HTML.PreviousUpdatesEditor  ( _editedElement, _document );             
  55.             
  56.             this.selectedDownloadLocation = null;
  57.         }
  58.         
  59.     }
  60.     
  61.     NOF_UpdatesMainWindow.inherits( NOF.HTML.TabbedMenuEditorWindow )
  62.     {
  63.         
  64.         var members = NOF_UpdatesMainWindow.prototype;
  65.         
  66.         members.defaultName        = null;           
  67.         
  68.         /** 
  69.         * onInit
  70.         **/        
  71.         members.onInit          = function () {        
  72.             
  73.             this.addChild( this.currentUpdateEditor );
  74.             this.addChild( this.previousUpdatesEditor );            
  75.             
  76.             //initialize main tabbed menu
  77.             var tabbedMenu = new NOF.UI.TabbedMenu( "updatesMainMenu", "NOF.UPDATES_MainMenu", this );
  78.             tabbedMenu.setDocument ( this.getDoc() );    
  79.             
  80.             tabbedMenu.addItem ( new NOF.UI.TabMenuItem ( this.currentUpdateEditor.getName(), this.getResourceProperty( "currentUpdateEditor.title" ), "content0" ) );
  81.             tabbedMenu.addItem ( new NOF.UI.TabMenuItem ( this.previousUpdatesEditor.getName(), this.getResourceProperty( "previousUpdatesEditor.title" ), "content1" ) );
  82.             
  83.             tabbedMenu.addListener( this ); //adds it to all menu items
  84.             
  85.             this.setMenu ( tabbedMenu );
  86.             NOF.addVariable ("UPDATES_MainMenu", tabbedMenu );
  87.             
  88.             this.super_onInit();    //this is implemented in base class and simply notifies the listners that this window has intitialised
  89.         }
  90.         
  91.         /** method onLoad
  92.         *   @param
  93.         *    @return
  94.         */
  95.         members.onLoad          = function () {        
  96.             
  97.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onLoad begin");
  98.             
  99.             this.setTitle( this.getResourceProperty('UpdateAvailable.title') );
  100.             this.setSize( this.getResourceProperty('UpdateAvailable.dlgWidth') - 0, this.getResourceProperty('UpdateAvailable.dlgHeight') - 0 );
  101.             
  102.             // select first tab
  103.             var tabbedMenu = this.getMenu();
  104.             tabbedMenu.selectItem( tabbedMenu.getItem( this.currentUpdateEditor.getName()) );
  105.             this.currentUpdateEditor.show();        
  106.             
  107.             // load editors
  108.             this.currentUpdateEditor.onLoad();
  109.             this.previousUpdatesEditor.onLoad();
  110.             
  111.             var ds = this.getDoc().getElementById("c.downloadFromSelect");
  112.             this.selectedDownloadLocation = ds.options[ds.selectedIndex].text;
  113.             
  114.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onLoad this.selectedDownloadLocation = "+this.selectedDownloadLocation );
  115.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onLoad end" );
  116.         }
  117.         
  118.         /** 
  119.             * method onUpdateNow
  120.             */          
  121.         members.onUpdateNow        = function () {
  122.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onUpdateNow selectedMenu - " + this.getMenu().getCurrentItem().getId() );      
  123.             dispatchEvent(this.getMenu().getCurrentItem().getId()+'.UpdateNow', null);
  124.         }
  125.         
  126.         /**
  127.             * method onDownload
  128.             **/                  
  129.         members.onDownload        = function () {
  130.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onDownload init " );
  131.             var id = this.getMenu().getCurrentItem().getId();
  132.             dispatchEvent(id+'.Download', null);
  133.         }
  134.         
  135.         /** method onChangeDownloadLocation 
  136.         *   @param source
  137.         */          
  138.         members.onChangeDownloadLocation = function ( source ) {            
  139.             
  140.             this.selectedDownloadLocation = source.options[source.selectedIndex].text;
  141.             //NOF.util_logging_ConsoleLogger_global.info("UpdatesMainWindow.onChangeDownloadLocation selectedLocation - " + this.selectedDownloadLocation );
  142.             
  143.             var id = this.getMenu().getCurrentItem().getId();
  144.             if ( this.currentUpdateEditor.getName() == id ) {
  145.                 this.previousUpdatesEditor.getDoc().getElementById("p.downloadFromSelect").selectedIndex = source.selectedIndex;                    
  146.             } else { // must be previousUpdatesEditor
  147.                 this.currentUpdateEditor.getDoc().getElementById("c.downloadFromSelect").selectedIndex = source.selectedIndex;
  148.             }                        
  149.         }
  150.         
  151.         /**
  152.             * method onUnload
  153.             **/                      
  154.         members.onUnload        = function () {        
  155.         }  
  156.         
  157.     }    
  158.     
  159.     NOF.UPDATE.HTML.__proto__.UpdatesMainWindow = NOF_UpdatesMainWindow;
  160.     
  161. }